class HttpError extends Error {
  constructor(msg = '服务器错误', code = 500, status = 500) {
    super();
    this.msg = msg;
    this.code = code;
    this.status = status;
  }
};
class HttpSuccess extends HttpError {
  constructor(msg = '请求成功', code = 200, status = 200) {
    super();
    this.msg = msg;
    this.code = code;
    this.status = status;
  }
};

class AuthFailed extends HttpError {
  constructor(msg = '授权失败', code = 10004) {
    super();
    this.msg = msg;
    this.code = code;
    this.status = 401;
  }
};

class Forbbiden extends HttpError {
  constructor(msg = '禁止访问', code = 10006) {
    super();
    this.msg = msg;
    this.code = code;
    this.status = 403;
  }
};

class LikeError extends HttpError {
  constructor(msg = '你已经点过赞啦', code = 400) {
    super();
    this.msg = msg;
    this.code = code;
    this.error_code = 60001;
  }
};

class DislikeError extends HttpError {
  constructor(msg = '你已取消点赞', code = 400) {
    super();
    this.msg = msg;
    this.code = code;
    this.error_code = 60002;
  }
};

module.exports = {
  HttpError,
  HttpSuccess,
  AuthFailed,
  Forbbiden,
  LikeError,
  DislikeError
};